import React, { useEffect, useState, useReducer, useContext } from 'react';
import Third from './Third';
import {MyContext} from './provider';

export default function Sub() {
  const { state, dispatch } = useContext(MyContext);

  console.log('sub')
  return (
    <div>
      sub Count: {state.count}
      <Third/>
      <button onClick={() => dispatch({type: 'increment'})}>+</button>
      <button onClick={() => dispatch({type: 'decrement'})}>-</button>
    </div>
  );
}
